// $Id$
// Licensed under Apache License Version 2.0
// See: http://www.apache.org/licenses/LICENSE-2.0.html
package de.servicezombie.tcmdb.service;

import de.servicezombie.tcmdb.dao.mongo.MongoUtils;
import de.servicezombie.tcmdb.rest.vo.WsTestExecution;

public class RolloutDefinitionByExistingExecutionStrategy implements FieldCopyStrategy {
	
	private String defaultResolution;
	
	public void setDefaultResolution(String defaultResolution) {
		this.defaultResolution = defaultResolution;
	}
	
	/**
	 * Copies these values from 'from' to 'into':
	 * 
	 * <ul>
	 * <li>group</li>
	 * <li>affectedVersion</li>
	 * <li>responsible</li>
	 * <li>resolution is the default resolution</li>
	 * </ul>
	 * 
	 * and removes id information
	 */
	@Override
	public void copy(WsTestExecution from, WsTestExecution into) {
		
		into.setGroup(from.getGroup());
		into.setAffectedVersion(from.getAffectedVersion());
		into.setResponsible(from.getResponsible());
		into.setResolution(defaultResolution);
		MongoUtils.invalidateId(into);
		
	}

}
